﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Webitel
{
	/// <summary>
	/// Логика взаимодействия для MainWindow.xaml
	/// </summary>
// ReSharper disable once RedundantExtendsListEntry
	public partial class MainWindow : Window
	{
		private static MainWindow _instance;
		public static MainWindow get_instance()
		{
			return _instance;
		}

		public MainWindow()
		{
			_instance = this;
			InitializeComponent();
		}

		private void MainTitleBar_MouseDoubleClick(object sender, MouseButtonEventArgs e)
		{
			Hide();
		}

		private void MainTitleBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
		{
			DragMove();
		}

		private void MainTitleBar_MouseDown(object sender, MouseButtonEventArgs e)
		{
			if (e.ChangedButton == MouseButton.Middle)
			{
				Close();
			}
		}

		private void mainWindow_KeyDown(object sender, KeyEventArgs e)
		{
			Dialpad.KeyPress(sender, e);
		}

		private void mainWindow_Loaded(object sender, RoutedEventArgs e)
		{
			Hide();
			Tray.Initialize();
		}

		private void mainWindow_Closing(object sender, CancelEventArgs e)
		{
			Tray.Hide();
		}

	}
}
